package com.xiaoyg.send;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author xiaoyg
 * @Title: Send
 * @ProjectName spring-rabbitmq-async
 * @Description: 发送生产者
 * @date 2018/12/715:52
 */
public class Send {

    public static void main(String[] args) throws InterruptedException {

        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext-rabbitmq-async-send.xml");

        RabbitTemplate rabbitTemplate = context.getBean(RabbitTemplate.class);

        for (int i = 0; i < 1000; i++) {
            rabbitTemplate.convertAndSend("test spring async=>"+i);
            Thread.sleep(3000);
        }

    }

}
